package com.bolang.onlycode.demo.expressway;

import java.util.ArrayList;
import java.util.List;

public class Compute {
    public static void main(String[] args) {
        ExpressWay xiHan = new ExpressWay(1, "西汉高速", 1257, 1356);
        ExpressWay raoCheng = new ExpressWay(2, "绕城高速", 0, 80);
        PriceStation huXian = new PriceStation("户县收费站", 1260, 1);
        PriceStation zhuQue = new PriceStation("朱雀收费站", 1280, 1);
        PriceStation hanZhong = new PriceStation("汉中收费站", 1300, 1);
        PriceStation quJiang = new PriceStation("曲江收费站", 20, 2);
        PriceStation gaoXin = new PriceStation("高新收费站", 50, 2);
        PriceStation hanCheng = new PriceStation("汉城收费站", 70, 2);
        List<PriceStation>  stationList=new ArrayList<>();
        List<ExpressWay>  wayList=new ArrayList<>();
        stationList.add(huXian);
        stationList.add(zhuQue);
        stationList.add(hanZhong);
        stationList.add(quJiang);
        stationList.add(gaoXin);
        stationList.add(hanCheng);
        wayList.add(xiHan);
        wayList.add(raoCheng);
        printLength(xiHan,raoCheng);
        printStation(wayList,stationList);
    }
    public static void printLength( ExpressWay one, ExpressWay two){
        if(one.getLength()<= two.getLength()){
            one.printLength();
            two.printLength();
        }else {
            two.printLength();
            one.printLength();
        }
    }
    public static void printStation(List<ExpressWay> wayList, List<PriceStation>  stationList){
        for (ExpressWay expressWay : wayList) {
            expressWay.printStation(stationList);
        }
    }
}
